package utils
{
	import flash.system.ApplicationDomain;
	
	public class ApplicationDomainUtil
	{
		private static var _applicationDomain:ApplicationDomain;
		
		public function ApplicationDomainUtil()
		{
		}
		
		public static function get applicationDomain():ApplicationDomain
		{
			return _applicationDomain;
		}
		
		public static function set applicationDomain(value:ApplicationDomain):void
		{
			_applicationDomain = value;
		}
		
		public static function getDefinitionByName(classname:String):Object
		{
			return _applicationDomain.getDefinition(classname);
		}
		
		public static function hasDefinition(classname:String):Object
		{
			return _applicationDomain.hasDefinition(classname);
		}
		
		public static function getDefinitionObject(link:String):*
		{
			var obj:*=null;
			if(hasDefinition(link)) obj=getDefinitionByName(link);
			if(!obj) return null;
			return new obj();
		}
	}
}